/* 
 * File:   RothC_pool.h
 * Author: dechow
 *
 * Created on 31. Mai 2011, 12:06
 */

#ifndef ROTHC_POOL_H
#define	ROTHC_POOL_H
using namespace std;
class RothC_pool
{
    double C;
    double N;
    double kC;
    double default_CN;
    string name;

public:
    RothC_pool()
    {
        name="";
        C=0;
        kC=0;
        N=0;
        default_CN=0;
    }
    RothC_pool(string name,double iC, double ikC, double idefault_CN)
    {
        if ((iC<0)||(iC>300)) err::err2("RothC_pool::RothC_pool: Carbon stock in an invalid range");
        C=iC;
        if((ikC<0)||(ikC>1000)) err::err2("RothC_pool::RothC_pool: Carbon degradation constant in an invalid range");
        kC=ikC;
        if((idefault_CN<0)||(idefault_CN>500)) err::err2("RothC_pool::RothC_pool: CN ratio in an invalid range");
        default_CN=idefault_CN;
    }
    ~RothC_pool(){;}
    double degrad(double timestep,double coeffT, double coeffWC,double coeffveg)
    {
        double  rate=1-exp(-kC*coeffT*coeffWC*coeffveg*timestep/365.2);
        double degrad=C*rate;
        C=C*(1-rate);
        return degrad;
    }
    int set_kC(double ikC)
    {
        kC=ikC;
        return 0;
    }
    int print()
    {
        cout<<C<<kC<<default_CN<<endl;
        return 0;

    }
    

};

#endif	/* ROTHC_POOL_H */

